package ai;

import ai.dao.Insert;
import ai.dao.Select;

import java.io.Serializable;
import java.util.Scanner;

/**
 * Created by 杨济瑞 on 2016/8/10.
 */
public class Main {
    public static void main(String[] args) {
        Insert insert = new Insert();
        Select select = new Select();
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String input = scanner.nextLine();

            String[] strings = input.split(" ");

            if (strings.length == 3) {
                if (strings[0].equals("iyoga") && strings[1].equals("add-course")) {
                    insert.addCourse(strings[2]);
                    System.out.println(strings[2] + " 添加成功！");
                }
            } else if (strings.length == 5) {
                if (strings[0].equals("iyoga") && strings[1].equals("add-member")) {
                    Serializable memberId = insert.addMember(strings[2], strings[3], strings[4]);
                    System.out.println("OK." + strings[2] + "'s member id is " + memberId + ".");
                } else if (strings[0].equals("iyoga") && strings[1].equals("add-card") && strings[3].equals("次卡")) {
                    insert.addCard(strings[2], "100", Integer.parseInt(strings[4]));
                    System.out.println("OK.A NEW " + strings[3] + " Add to " + strings[2] + ".");
                }
            } else if (strings.length == 4) {
                if (strings[0].equals("iyoga") && strings[1].equals("add-card") && strings[3].equals("年卡")) {
                    insert.addCard(strings[2], "-1");
                    System.out.println("OK.A NEW " + strings[3] + "Add to " + strings[2] + ".");
                }
            } else if (strings.length == 6) {
                if (strings[0].equals("iyoga") && strings[1].equals("add-coach")) {
                    insert.addCoach(strings[2], Integer.parseInt(strings[3]), strings[4], strings[5]);
                    System.out.println("教练 " + strings[2] + " 添加成功！");
                }
            }

        }

    }
}
